<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <script type="text/javascript">
        function timedMsg(){
            var t=setTimeout("alert('5秒')",5000)
        }

        </script>
        
    </head>
    <body>
        <form >
            <input type="button" value="显示定时警示框" onClick="timedMsg()">
        </form>
        <p>请点击上面的按钮。警告框会在 5 秒后显示。</p>
    </body>

</html>